classdef GClass < glib.GInterface

  methods
    function varargout = subsref(obj, S, noutrequested)
      if nargin < 3
        noutrequested = nargout;
        indirectReturn = false;
      else
        if nargout > 1, error 'Too many outputs for indirect return', end
        indirectReturn = true;
      end
      if length(S) > 2, error 'Too many subscripts on GClass', end
      switch S(1).type
        case '()'
          if noutrequested > 1, 'Too many outputs for GObject', end
          ret = glib.GObject.new(obj, S(1).subs{:});
          if indirectReturn, varargout{1} = { ret };
          else varargout{1} = ret; end
        otherwise
          ret = subsref@glib.GInterface(obj, S, noutrequested);
          if indirectReturn, varargout{1} = ret;
          else varargout = ret; end
      end
    end  % function subsref

    %% This is an internal constructor!
    %% To fetch a GClass, use the repository glib.gi.getRepos()
    function obj = GClass(gtypetype, gtype, giInfo, name)
      obj@glib.GInterface(gtypetype, gtype, giInfo, name);
    end

    function disp(obj)
      disp(sprintf('[GClass %s as %s]', char(obj), name(obj)));
    end
    
  end  % Public Methods

end  % Classdef
